package com.mspbots.core.report.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mspbots.core.DefaultBaseMapper;
import com.mspbots.core.report.model.*;
import com.mspbots.core.script.model.TenantScript;
import com.mspbots.core.wise.model.TenantConfiguration;
import com.mspbots.core.wise.model.TenantExceptionLog;
import com.mspbots.core.wise.model.TenantUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface HealthReportMapper extends DefaultBaseMapper<TenantHealthReportDetail> {

    IPage<TenantHealthReportDetail> listTenant(Page<TenantHealthReportDetail> page, @Param("query") HealthReportDTO query);

    List<TenantExceptionLog> selectTenantAuthority(HealthReportDTO query);

    TenantExceptionLog selectLastSync(HealthReportDTO query);

    List<User> selectTenantAdmin(HealthReportDTO query);

    Integer selectCountTenantUser(HealthReportDTO query);

    Integer selectCountTenantUserMapping(HealthReportDTO query);

    List<TenantUser> selectTenantUserNotMapping(HealthReportDTO query);

    List<TenantUser> selectTenantUserNoManager(HealthReportDTO query);

    List<TenantUser> selectTenantUserNoWorkSchedule(HealthReportDTO query);

    List<TenantScript> selectTenantBot(HealthReportDTO query);

    Integer selectCountMessages(HealthReportDTO query);

    Integer selectCountMessagesOnReceived(HealthReportDTO query);

    List<TenantConfiguration> selectTenantKeySetting(HealthReportDTO query);

    long listTenantCount(HealthReportDTO query);

    Integer selectCountUserNoReceived(HealthReportDTO query);

    Integer selectCountUserSendMessage(HealthReportDTO query);

    Integer selectCountUserHasReceived(HealthReportDTO query);

    List<HealthReportCount> selectCountBotMessages(HealthReportDTO query);

    TenantExceptionLog selectLastTeamsLog(HealthReportDTO query);

    List<TenantHealthReportDetail> checkListTenant();


    List<TenantHealthReport> selectHealthReport(Long tenantId);

    Integer updateHealth(TenantHealthReportDetail entity);

    Integer insertHealth(TenantHealthReportDetail entity);

    TenantHealthReportDetail queryTenantHealth(Long tenantId);
}
